﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.LiveFX.Client;
using Microsoft.LiveFX.ResourceModel;

namespace MeshSilverLightSilverlight
{
    public partial class Page : UserControl
    {
        private MeshApplicationService meshApp;

        public Page()
        {
            InitializeComponent();

            chart.DataContext = new KeyValuePair<string, int>[] {
                new KeyValuePair<string, int>("Work", 9), 
                new KeyValuePair<string, int>("Driving", 2), 
                new KeyValuePair<string, int>("Family", 4), 
                new KeyValuePair<string, int>("Sleep", 8), 
                new KeyValuePair<string, int>("Friends", 1) };

            meshApp = Application.Current.GetMeshApplicationService();
            // once mesh contents are loaded we get callback
            meshApp.LoadCompleted += new EventHandler(meshAppLoaded);
            meshApp.LoadAsync(null);
        }

        // Called when application loads
        void meshAppLoaded(object sender, EventArgs e)
        {
            // Mesh application service object is now loaded and usable.        
        }
    }
}
